package com.yixun.qfbao.xf.model.enums;

import org.apache.commons.lang.StringUtils;

public enum OrderPropertyEnum {
	// 10.创建时间降序
	ORDER_PROPERTY_10("10", "k.updateTime+0", "desc"),
	// 20.创建时间升序
	ORDER_PROPERTY_20("20", "k.updateTime+0", "asc"),
	// 30.均价升序
	ORDER_PROPERTY_30("30", "k.averagePrice+0", "desc"),
	// 40.降价降序
	ORDER_PROPERTY_40("40", "k.averagePrice+0", "asc"),
	// 50.开盘日期降序
	ORDER_PROPERTY_50("50", "k.openingTime+0", "desc"),
	// 60.开盘日期升序
	ORDER_PROPERTY_60("60", "k.openingTime+0", "asc");

	private String code;

	private String name;

	private String sort;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSort() {
		return sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	private OrderPropertyEnum(String code, String name, String sort) {
		this.code = code;
		this.name = name;
		this.sort = sort;
	}

	public static OrderPropertyEnum getByNo(String code) {
		if (StringUtils.isBlank(code)) {
			return null;
		}
		for (OrderPropertyEnum menum : values()) {
			if (menum.getCode().equals(code)) {
				return menum;
			}
		}
		return null;
	}

}
